package com.kingschan.jeasytag.tag.head;

import java.util.HashMap;
import java.util.Map;
import com.kingschan.jeasytag.container.EasyTagContainer;
import com.kingschan.jeasytag.container.impl.EasyTagContainerImpl;
import com.kingschan.jeasytag.tag.grid.GridTag;
import com.kingschan.jeasytag.tag.power.ExportTag;
import com.kingschan.jeasytag.tag.power.SearchBoxTag;
/**
 * tag support class example : css javascript
 * @author kingschan
 *date:2013-6-8
 */
public class SupportResources {

	private static Map<Class<?>, String> map = new HashMap<Class<?>, String>();	
	private static EasyTagContainer container = EasyTagContainerImpl.getInstance();
	static{		
		//base support file		
		StringBuffer base = new StringBuffer();
		base
		
		.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"${contentpath}/jeasytag_resource/easyui/themes/icon.css\">\n")
		.append("<script type=\"text/javascript\"src=\"${contentpath}/jeasytag_resource/easyui/jquery-1.8.0.min.js\"></script>\n")
		.append("<script type=\"text/javascript\"src=\"${contentpath}/jeasytag_resource/easyui/jquery.easyui.min.js\"></script>\n")
		.append("<script type=\"text/javascript\" src=\"${contentpath}/jeasytag_resource/easyui/locale/easyui-lang-zh_CN.js\"></script>\n")
		.append("<script type=\"text/javascript\"src=\"${contentpath}/jeasytag_resource/tag/commom.js\"></script>\n");
		map.put(EasyTagHead.class, base.toString());		
		map.put(SearchBoxTag.class, "<script type=\"text/javascript\" src=\"${contentpath}/jeasytag_resource/tag/searchBox.js\"></script>\n");
		map.put(ExportTag.class, "<script type=\"text/javascript\" src=\"${contentpath}/jeasytag_resource/tag/grid_export.js\"></script>\n");
		map.put(GridTag.class, "<script type=\"text/javascript\" src=\"${contentpath}/jeasytag_resource/tag/grid.js\"></script>\n");
		
		
	}
	/**
	 * returns the tag references of resources
	 * @param key
	 * @return
	 */
	public static String getResources(Class<?> key){
		return map.get(key).replace("${contentpath}", container.getContentPath());
		
	}
}
